package servlet;

import bean.admin.status.AdminStatusBean;
import util.DealParams;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

@WebServlet("/admin/status")
public class AdminStatusServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("utf-8");
        Map<String,String> params = DealParams.getParamsMap(req);
        String token = params.get("token");
        String status = params.get("status");
        AdminStatusBean bean = new AdminStatusBean();
        PrintWriter out = resp.getWriter();
        out.print(bean.changeStaus(token,status));
    }
}
